<!--  房源管理  -->
<template>
    <div class="room">
        <div class="search">
            <el-form :model="searchData" :inline="true" size="mini" class="demo-form-inline">
                <el-form-item label="市">
                    <el-select v-model="options.city_name" disabled>
                    </el-select>
                </el-form-item>
                <el-form-item label="楼盘字典" prop="building_id">
                    <el-autocomplete v-model="searchData.building_id" :fetch-suggestions="buildingquerySearchAsync" placeholder="请输入" :trigger-on-focus="false" :hide-loading="true"></el-autocomplete>
                </el-form-item>
                <el-form-item label="房屋类型" prop="type_of_house_sale">
                    <el-select v-model="searchData.type_of_house_sale" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in options.optimal" :key="index" :label="item.st_name" :value="item.st_id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="用途" prop="use_type">
                    <el-select v-model="searchData.use_type" placeholder="请选择" @change="typeChange">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in options.use" :key="index" :label="item.st_name" :value="item.st_id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="状态" prop="status">
                    <el-select v-model="searchData.status" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in options.status" :key="index" :label="item.st_name" :value="item.st_id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="面积" prop="r_acreage_begin">
                    <el-input v-model="searchData.r_acreage_begin" class="small_inp"></el-input>
                </el-form-item>_
                <el-form-item label="" prop="r_acreage_end">
                    <el-input v-model="searchData.r_acreage_end" class="small_inp"></el-input>
                </el-form-item>
                <el-form-item label="楼层" prop="floor_begin">
                    <el-input v-model="searchData.floor_begin" class="small_inp"></el-input>
                </el-form-item>_
                <el-form-item label="" prop="floor_end">
                    <el-input v-model="searchData.floor_end" class="small_inp"></el-input>
                </el-form-item>
                <el-form-item label="价格" prop="small_price">
                    <el-input v-model="searchData.small_price" class="small_inp"></el-input>
                </el-form-item>_
                <el-form-item label="" prop="big_price">
                    <el-input v-model="searchData.big_price" class="small_inp"></el-input>
                </el-form-item>
                <el-form-item label="部门" prop="r_d_id">
                    <el-select v-model="searchData.r_d_id" placeholder="请选择部门" @change="obtainUsers">
                        <!-- <el-option v-for="(item,index) in optionName" :key="index" :label="item.name" :value="item.id"></el-option> -->
                        <el-option-group v-for="group in optionName" :key="group.label" :label="group.label">
                            <el-option v-for="item in group.options" :key="item.value" :label="item.label" :value="item.value">
                            </el-option>
                        </el-option-group>
                    </el-select>
                </el-form-item>
                <el-form-item label="员工" prop="source_uid">
                    <el-select v-model="searchData.source_uid" placeholder="请选择员工">
                        <el-option v-for="(item,index) in userTypes" :key="index" :label="item.u_username" :value="item.u_id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="交易" prop="trading_type">
                    <el-select v-model="searchData.trading_type" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in trading_type_opt" :key="index" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="日期" prop="date_type">
                    <el-select v-model="searchData.date_type" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in date_type_opt" :key="index" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="开始" prop="start_time">
                    <el-date-picker type="date" placeholder="请选择" v-model="searchData.start_time" value-format="yyyy-MM-dd"></el-date-picker>
                </el-form-item>
                <el-form-item label="结束" prop="end_time">
                    <el-date-picker type="date" placeholder="请选择" v-model="searchData.end_time" value-format="yyyy-MM-dd"></el-date-picker>
                </el-form-item>
                <el-form-item label="" prop="checking_way">
                    <el-checkbox v-model="searchData.checking_way">钥匙房</el-checkbox>
                </el-form-item>
                <el-form-item label="类型" prop="housing_types" v-if="typeOne === 1">
                    <el-select v-model="searchData.housing_types" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in options.zsq_type" :key="index" :label="item.st_name" :value="item.st_id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="类型" prop="housing_types" v-if="typeOne === 2">
                    <el-select v-model="searchData.housing_types" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in options.spw_type" :key="index" :label="item.st_name" :value="item.st_id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="类型" prop="housing_types" v-if="typeOne === 3">
                    <el-select v-model="searchData.housing_types" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in options.xx_type" :key="index" :label="item.st_name" :value="item.st_id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="类型" prop="housing_types" v-if="typeOne === 4 || typeOne === 5">
                    <el-select v-model="searchData.housing_types" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in options.cc_type" :key="index" :label="item.st_name" :value="item.st_id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="类型" prop="housing_types" v-if="typeOne === 6">
                    <el-select v-model="searchData.housing_types" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in options.dp_type" :key="index" :label="item.st_name" :value="item.st_id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="类型" prop="housing_types" v-if="typeOne === 7">
                    <el-select v-model="searchData.housing_types" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in options.c_type" :key="index" :label="item.st_name" :value="item.st_id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="房型" prop="roomtype">
                    <el-select v-model="searchData.roomtype" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in options.roomtype" :key="index" :label="item.st_name" :value="item.st_id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="层数" prop="numlayers">
                    <el-select v-model="searchData.numlayers" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in options.numlayers" :key="index" :label="item.st_name" :value="item.st_name"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="朝向" prop="oriented">
                    <el-select v-model="searchData.oriented" placeholder="请选择">
                        <el-option label="全部" value=""></el-option>
                        <el-option v-for="(item,index) in options.oriented" :key="index" :label="item.st_name" :value="item.st_name"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="关键字" prop="keywords">
                    <el-input v-model="searchData.keywords" placeholder="编号、姓名、电话、房号"></el-input>
                </el-form-item>

                <el-form-item>
                    <el-button type="primary" @click="search">查询</el-button>
                    <el-button type="primary" @click="addAccount">添加房源</el-button>
                </el-form-item>
            </el-form>
        </div>
        <div class='content'>
            <!-- 列表 --> 
            <div class='list'>
                <el-table :data="list.data" style="width: 100%" @row-click="getfollowlist">
                    <el-table-column align="center" prop="property_number" label="房源编号" width="120"></el-table-column>
                    <el-table-column align="center" prop="trading_name" label="交易" width="100"></el-table-column>
                    <el-table-column align="center" prop="building_name" label="楼盘字典" width="120"></el-table-column>
                    <el-table-column align="center" prop="few_building" label="栋座" width="120"></el-table-column>
                    <el-table-column align="center" prop="position" label="位置" width="120"></el-table-column>
                    <el-table-column align="center" prop="room_number" label="房号" width="120"></el-table-column>
                    <el-table-column align="center" prop="floor" label="楼层" width="120"></el-table-column>
                    <el-table-column align="center" prop="total_layer" label="总层" width="120"></el-table-column>
                    <el-table-column align="center" prop="r_acreage" label="面积" width="120"></el-table-column>
                    <el-table-column align="center" prop="use_name" label="用途" width="120"></el-table-column>
                    <el-table-column align="center" prop="housing_name" label="房屋类型" width="120"></el-table-column>
                    <el-table-column align="center" prop="r_info.orientation" label="朝向" width="120"></el-table-column>
                    <el-table-column align="center" prop="price" label="售总价" width="120"></el-table-column>
                    <el-table-column align="center" prop="rents" label="租总价" width="120"></el-table-column>
                    <el-table-column align="center" prop="trading_state_name" label="房源状态" width="120"></el-table-column>
                    <el-table-column align="center" prop="name" label="部门" width="120"></el-table-column>
                    <el-table-column align="center" prop="u_username" label="员工" width="120"></el-table-column>
                    <el-table-column align="center" prop="disc_name" label="公私" width="120"></el-table-column>
                    <el-table-column align="center" prop="r_follow_time" label="最后跟进日" width="120"></el-table-column>
                    <el-table-column align="center" fixed="right" label="操作" width="120">
                        <template slot-scope="scope">
                            <el-button @click.native.prevent="edit(scope.row)" type="text" size="small">编辑</el-button>
                            <el-button @click.native.prevent="delect(scope.row)" type="text" size="small">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <!-- 分页 -->
                <el-pagination :current-page="roomcurrent" @current-change="handleCurrentChange" :total="list.total" style="margin-top:30px;"></el-pagination>
                
            </div>
            <!-- 主要信息、跟进列表 -->
            <div class="mo_bottom">
                <div class="mo_bottom_left">
                    <!-- 客源信息 -->
                    <p class="mo_tit">{{maininfo.first}}</p>
                    <p class="txt">{{maininfo.secound}}</p>
                    <p class="remarks">{{maininfo.third}}</p>
                    <p>{{maininfo.fouth}}</p>
                </div>
                <div class="operation">
                    <!-- 跟进列表 -->
                    <el-table :data="followlist" tooltip-effect="light" style="width: 100%" class="followtable" :show-header="false">
                        <el-table-column align="center" :formatter="followFun" prop="f_content" label="跟进" show-overflow-tooltip></el-table-column>
                        <el-table-column align="center" prop="u_username" label="跟进人" width="120"></el-table-column>
                        <el-table-column align="center" prop="f_created_at" label="跟进时间" width="140"></el-table-column>
                    </el-table>
                     
                </div>
            </div>

            <!-- 上班考勤 -->
            <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
                <p style="line-height:1.5em;">{{userinfo}}</p>
                <p style="line-height:1.5em;">{{worktime}}</p>
                <p style="line-height:1.5em;">{{info}}</p> 
                <span slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="signclose" size="small">关 闭</el-button>
                </span>
            </el-dialog>
            <!-- 业务提醒 -->
            <el-dialog title="业务提醒" :visible.sync="reminddialogVisible" width="50%">
                <el-table :data="reminddata" style="width: 100%" :show-header="false" @row-dblclick="reminddb">
                    <el-table-column prop="connect" label="内容"></el-table-column>
                    <el-table-column align="center" label="操作" width="140" fixed="right">
                        <template slot-scope="scope">
                            <el-button @click.native.prevent="reminddb(scope.row)" type="text" size="small">查看</el-button>
                            <el-button @click.native.prevent="follow(scope.row)" type="text" size="small">处理跟进提醒</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <p style="line-height:1.5em;color:#999;font-size: 13px;margin-top: 25px;">（双击鼠标可查看记录哦~）</p>
                <span slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="reminddialogVisible = false" size="small">关 闭</el-button>
                </span>
            </el-dialog>
            <!-- 编辑跟进 -->
            <el-dialog title="修改跟进" :visible.sync="editfollowdialogVisible" width="70%" center v-if="editfollowdialogVisible">
                <!-- followsearch: 跟进数据查询条件   parentid:房客源id    resourcesdata: 1为房源，2为客源   classdata：1为添加跟进，2为修改跟进 -->
                <Editfollow :followsearch="followsearch" :parentid="0" :resourcesdata="1" :classdata="2" :permissionFollow="1" @followevent="followievent" />
            </el-dialog>

            <!-- 编辑房源信息 -->
            <el-dialog title="房源" :visible.sync="roomdialogVisible" width="70%" center>
                <!-- backlist 判断是否有返回列表按钮，0为有，1为无        maininfo判断是否返回有底部房源主要信息  0为无 1为有 -->
                <Editroom backlist="1" maininfo="0"/>
            </el-dialog>
            <!-- 编辑客源信息 -->
            <el-dialog title="客源" :visible.sync="resourcesdialogVisible" width="70%" center>
                <!-- backlist 判断是否有返回列表按钮，0为有，1为无        maininfo判断是否返回有底部房源主要信息  0为无 1为有 -->
                <Editresources backlist="1" maininfo="0"/>
            </el-dialog>
            <!-- 编辑跟进提醒 -->
            <el-dialog :title="followtitle" :visible.sync="followdialogVisible" width="70%" center v-if="followdialogVisible">
                <!-- followsearch: 跟进数据查询条件   parentid:房客源id    resourcesdata: 1为房源，2为客源   classdata：1为添加跟进，2为修改跟进    -->
                <Editfollow :followsearch="followsearch" :parentid="0" :resourcesdata="0" :classdata="2" :permissionFollow="1" @followevent="followievent" @processingevent="processingevent" />
            </el-dialog>

        </div>
    </div>
</template>
<style>
    .home .view-content{
        width: 87%;
    }
    .el-form-item__label,.el-form-item__content{
        font-size: 12px;
    }
    .el-input{
        padding-right: 5px;
    }
    .el-select-dropdown__item{
        font-size: 12px;
        padding: 0px 10px;
        height: 26px;
        line-height: 26px;
    }
    .el-input,.el-date-editor.el-input{
        width: 145px;
    }
    .el-checkbox__label{
        font-size: 12px;
    }
    .el-checkbox__inner{
        vertical-align: bottom;
    }
    .small_inp.el-input{
        width: 55px;
    }
    .mo_bottom{
        font-size: 12px;
        line-height: 1.5em;
        margin-top: 10px;
    }
    .mo_bottom:after{
        content: ".";
        clear: both;
        display: block;
        overflow: hidden;
        height: 0;
    }
    .mo_bottom_left{
        float: left;
        width: 20%;
        border-right: 1px solid #e4e7ed;
        box-sizing: border-box;
    }
    .operation{
        float: left;
        width: 78%;
        padding-left: 2%;
    }
    .mo_bottom_left p{
        border-top: 1px solid #e4e7ed;
        padding: 2px 0px;
        color: #606266;
    }
    .mo_bottom_left p.mo_tit{
        color: brown;
        height: 18px;
        overflow: hidden;
    }
    .record_list{
        list-style: none;
        color: #606266;
        height: 165px;
        overflow-y: auto;
    }
    .record_list li{
        padding: 2px 0px;
        border-top: 1px solid #e4e7ed;
    }
    .remarks{
        height: 73px;
        overflow: hidden;
    }
    .followtable td{
        font-size: 12px;
        padding: 2px 0px;
    }
</style>
<script src='../../../contral/home_room.js'></script>

